<template>
  <el-dialog
    title="预览"
    :append-to-body="true"
    :visible.sync="visible"
    :before-close="close"
    :close-on-click-modal="false"
    fullscreen>

    <el-button type="success" class="pan-btn success-btn" v-print="'#mcheck'" size="mini">打印</el-button>

    <div id="mcheck">
      <div v-if="ZLSMP019R0106Visible">
        <div v-for="(cl, index) in list" :key="index">
          <Zl-Smp019-R0106 :childDataForm="cl" />
          <div style="width: 100%;height: 19px;"></div>
        </div>
      </div>
      <div v-if="hgz">
        <div v-for="(cl, index) in list" :key="index">
          <certification01 :childDataForm="cl" :current="index+1" :total="list.length" @sub="subList(index)" />
        </div>
      </div>
      <div v-if="bhgz">
        <div v-for="(cl, index) in list" :key="index">
          <no-certification01 :childDataForm="cl" :current1="index+1" :total1="list.length" @sub="subList(index)" />
        </div>
      </div>
      <div v-if="ZLSMP019R0107Visible">
        <div v-for="(cl, index) in list" :key="index">
          <Zl-Smp019-R0107 :childDataForm="cl" />
          <div style="width: 100%;height: 19px;"></div>
        </div>
      </div>
    </div>

  </el-dialog>
</template>

<script>
  import { isBlank } from '@/common/js/utils'
  import ZlSmp019R0106 from './pass/all-06'
  import Certification01 from './pass/certification-01'
  import NoCertification01 from './pass/no-certification-01'
  import ZlSmp019R0107 from './pass/ZL-SMP-019-R01-07'
  export default {
    data() {
      return {
        visible: false,
        list: [],
        ZLSMP019R0106Visible: false,
        hgz: false,
        bhgz: false,
        ZLSMP019R0107Visible: false
      }
    },
    props: ["childDataForm"],
    components: { ZlSmp019R0106,Certification01,NoCertification01,ZlSmp019R0107 },
    created() {
      if (!isBlank(this.childDataForm)) {
        let printNumber = this.childDataForm.printNumber
        if (!isBlank(printNumber)) {
          this[printNumber.replace(/[^a-zA-Z0-9]+/g,'')+'Visible'] = true
        }else if(this.childDataForm.printClassify == '合格证') {
          this.hgz = true
        }else if(this.childDataForm.printClassify == '不合格证') {
          this.bhgz = true
        }
        this.list = this.childDataForm.list
        this.visible = true
      }
    },
    methods: {
      subList(i) {
        this.list.splice(i,1)
      },
      close(val) {
        if (val) {
          this[val] = false
        }
        this.visible = false
        this.$emit('close')
      }
    }
  }
</script>

<style>
</style>
